{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "9b70e1c7",
   "metadata": {},
   "source": [
    "### 语法\n",
    "\n",
    "1. %法\n",
    "2. format()\n",
    "3. f法\n",
    "\n"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "3bfa8a9c",
   "metadata": {},
   "source": [
    "#### %法\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "id": "d71cbfe0",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'abc10de'"
      ]
     },
     "execution_count": 3,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "a = 'abcde'\n",
    "a1 = 'abc%sde'% 10\n",
    "a1"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "id": "d3b64c94",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'wqeqt0005whkt'"
      ]
     },
     "execution_count": 4,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "a2 = \"wqeqt%04dwhkt\"% 5\n",
    "a2"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "id": "e0a64748",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'wqeqt             5whkt'"
      ]
     },
     "execution_count": 5,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "a3 = \"wqeqt%14dwhkt\"% 5\n",
    "a3"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "id": "978286e1",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'wqeqtvvvvvvvvvvvvvvvaaaaawhkt'"
      ]
     },
     "execution_count": 7,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "a4 = \"wqeqt{1}{0}whkt\".format(\"aaaaa\",\"vvvvvvvvvvvvvvv\")\n",
    "a4"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "id": "aa0f801e",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'qeqtaaaaavvvvvvvvvvvvvvvwhkt'"
      ]
     },
     "execution_count": 9,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "a5 = f'qeqt{\"aaaaa\"}{\"vvvvvvvvvvvvvvv\"}whkt'\n",
    "a5"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "938b51d8",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.9.6"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
